import java.util.Stack;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: fzykd
 * Date: 2022-11-05
 * Time: 14:02
 */

//栈 先进后出
public class TestDemo {
    public static void main(String[] args) {
        Stack<Integer> stack = new Stack<>();
        stack.push(1);
        stack.push(2);
        stack.push(3);
        System.out.println(stack.pop());//弹出栈顶元素并删除
        System.out.println(stack.peek()); //获取栈顶元素 但是不删除

        //判断栈是否为空
        System.out.println(stack.empty());

        System.out.println("=================================");

        MyStack myStack = new MyStack(3);
        myStack.push(1);


        System.out.println(myStack.peek());
        System.out.println(myStack.pop());
        System.out.println(myStack.empty());


    }
}
